﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="order-details.aspx.cs" Inherits="EnmineKaitlin.admin.order_details" MasterPageFile="~/MasterPage/AdminDefault.Master" %>

<%@Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="CKFinder" Namespace="CKFinder" TagPrefix="CKFinder" %>
<asp:Content ID="ctnProductnew" runat="server" ContentPlaceHolderID="cphContent">
    <div class="form list">        
        <h2><span class="icon"><img src="../images/admin/Play.png"></span><asp:Label ID="lblFunction" runat="server" Text="Chi tiết hóa đơn"></asp:Label></h2>
        <div class="content">                                        
                <asp:Repeater ID="rptOrder" runat="server" OnItemCommand="rptOrder_ItemCommand">
                    <ItemTemplate>
                        <div class="form-left left">
                            <asp:Repeater ID="rptCustomer" runat="server" DataSource='<%#BindCustomer(int.Parse(Eval("IDCustomer").ToString())) %>'>
                                <ItemTemplate>
                                    <p class="label">Tên người mua hàng:</p>
                                    <p class="input"><asp:TextBox ID="txtCustomerName" Text='<%#Eval("CustomerName") %>' runat="server" Width="100%" CssClass="txt required"></asp:TextBox></p> 
                                    <p class="label">Tên đơn vị:</p>
                                    <p class="input"><asp:TextBox ID="txtOrganizationName" Text='<%#Eval("OrganizationName") %>' runat="server" Width="100%" CssClass="txt required number"></asp:TextBox></p>  
                                    <p class="label">Mã số thuế:</p>
                                    <p class="input"><asp:TextBox ID="txtTaxNumber" Text='<%#Eval("TaxNumber") %>' runat="server" Width="100%" CssClass="txt required number"></asp:TextBox></p>                             
                                    <p class="label">Địa chỉ:</p>
                                    <p class="input"><asp:TextBox ID="txtAddress" Text='<%#Eval("Address") %>' runat="server" Width="100%" CssClass="txt required number"></asp:TextBox></p>                                                         
                                </ItemTemplate>
                            </asp:Repeater>                            
                            <p class="label">Chi tiết đơn hàng:</p>                        
                            <asp:Repeater ID="rptOrderDetail" runat="server" DataSource='<%#BindOrderDetail(int.Parse(Eval("OrderID").ToString())) %>'>
                                <HeaderTemplate>
                                    <table class="tblorderdetail" border="0" cellspacing="1">
                                    <tr>
                                        <th width="20">STT</th>
                                        <th>Tên hàng hóa dịch vụ</th>
                                        <th>Số lượng</th>
                                        <th>Đơn giá</th>
                                        <th width="150">Thành tiền (vnđ)</th>
                                    </tr>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr>
                                        <td>1</td>
                                        <td><%#Eval("Name") %></td>
                                        <td><%#Eval("TotalQuantity") %></td>
                                        <td><%#Eval("Price")%></td>
                                        <td class="money"><%#Eval("TotalRevenueAmount")%></td>
                                    </tr>
                                </ItemTemplate>
                                <FooterTemplate>
                                    </table>
                                </FooterTemplate>
                            </asp:Repeater>
                            <table class="tblorderdetail" border="0" cellspacing="1">
                                <tr>                                                                      
                                    <td colspan="2" align="right">Cộng tiền hàng:</td>
                                    <td class="money" width="146"><%#Eval("TotalRevenueAmount")%></td>
                                </tr>
                                <tr>
                                    <td align="left">Thuế suất GTGT:&nbsp;<span class="money"><%#Eval("TaxAmount") %>%</span></td>
                                    <td align="right">Tiền thuế GTGT:</td>
                                    <td class="money"><%# (Decimal.Parse(Eval("TotalRevenueAmount").ToString()))*(Decimal.Parse(Eval("TaxAmount").ToString()))/100 %></td>
                                </tr>
                                <tr>                                    
                                    <td colspan="2" align="right">Giảm giá khuyến mại:</td>
                                    <td class="money"><%#Eval("TotalDiscountAmount") %></td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="right">Tổng cộng thanh toán:</td>
                                    <td class="money"><%#Eval("TotalPaidAmount") %></td>
                                </tr>
                            </table>                            
                        </div>
                        <div class="form-right right">
                            <div class="form-right-box">
                                <h2>Cập nhật</h2>
                                <div class="box-content"> 
                                    <table border="0">                                        
                                        <tr><td>Trạng thái:</td><td><asp:DropDownList ID="ddlStatus" runat="server" SelectedValue='<%#Eval("OrderStatus") %>'>
                                            <asp:ListItem Value="pending" Text="Chờ xử lý"></asp:ListItem>
                                            <asp:ListItem Value="success" Text="Đã xử lý"></asp:ListItem>
                                            <asp:ListItem Value="draft" Text="Hủy bỏ"></asp:ListItem>
                                        </asp:DropDownList></td></tr>
                                        <tr><td>Ngày cập nhật:</td><td><asp:TextBox ID="txtCreateDate" runat="server" Text='<%#DisplayDateTime(Convert.ToString(Eval("CreateDate"))) %>' Width="135" CssClass="txt datepicker required"></asp:TextBox></td></tr>
                                        <tr><td></td><td><asp:Button ID="btnUpdate" Text="Cập nhật" runat="server" CssClass="btn" CommandName="Update" CommandArgument='<%#Eval("OrderID") %>' /></td></tr>
                                    </table>                                    
                                </div>
                            </div>                                                                                                            
                        </div>
                    </ItemTemplate>
                </asp:Repeater>            
        </div>
    </div>
</asp:Content>